package com.zixi.ai.chat.controller;

import com.zixi.ai.chat.dto.ChatDto;
import com.zixi.ai.chat.service.IRagService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author wfg
 */
@RestController
@Tag(name = "MCP APIs")
@RequestMapping("/api/v1/rag")
@RequiredArgsConstructor
public class ZxRagController {
    private final IRagService ragService;
    /**
     * 内部接口不应该直接被 web 请求！
     */
    @GetMapping("/rag")
    @Operation(summary = "DashScope RAG Chat")
    public Flux<?> mcpChat(@Validated @RequestBody ChatDto chatDto) {
        return ragService.chat(chatDto.getChatId(), chatDto.getAiLlmId(), chatDto.getVectorStoreId(), chatDto.getMsg());
    }
}
